var isTest = false;
var radios = document.querySelectorAll("#map-styles input");
		 radios.forEach(function(ratio) {
		 ratio.onclick = setMapStyle;
	});

//设置
function setMapStyle() {
	 var styleName = "amap://styles/" + this.value;
	 map.setMapStyle(styleName);
}
///将(ids)array转化成Str			
function GetStr(resultArray)
{
	var result ="";
	for(var i=0;i<resultArray.length;i++)
	{
		result +=resultArray[i];
		if(i!=resultArray.length-1)
		{
			result+=",";
		}
	}
	
	return result;
}

function PlaySound(audioName)
{
	if(!isTest)
	{
		window.location.href = "uniwebview://PlaySound?audioName="+audioName;
	}
		
}

//根据勾股定位，计算两个点之间的夹角
function GetAngle(startPoint, endPoint)
{
	if (!(startPoint && endPoint)) {
		
		return 0;
	}
	
	//距离小于1米
	var dis = AMap.GeometryUtil.distance(startPoint, endPoint);
	if(dis<=1.0)
	{
		return 9999;
	}
	
	let dRotateAngle = Math.atan2(
		Math.abs(startPoint.lng - endPoint.lng),
		Math.abs(startPoint.lat - endPoint.lat)
	);
	if (endPoint.lng >= startPoint.lng) {
		if (endPoint.lat >= startPoint.lat) {
		} else {
			dRotateAngle = Math.PI - dRotateAngle;
		}
	} else {
		if (endPoint.lat >= startPoint.lat) {
			dRotateAngle = 2 * Math.PI - dRotateAngle;
		} else {
			dRotateAngle = Math.PI + dRotateAngle;
		}
	}
	dRotateAngle = (dRotateAngle * 180) / Math.PI;
	
	if(CheckNull_Nan_Undefined(dRotateAngle))
	{
		dRotateAngle = 0;
	}
	return dRotateAngle;
}

function CheckNull(obj)
{
	if(obj==null || typeof(obj)=='undefined')
	{
		return true;
	}
	
	return false;
}

function CheckNaN(obj)
{
	if(isNaN(obj))
	{
		return true;
	}
	
	return false;
}

function CheckNull_Nan_Undefined(obj)
{
	if (!obj) 
	{ 
		return true;
	}
	return false;
}
